/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package clinicapoo.view.utils;

import clinicapoo.model.Especialidade;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;

/**
 *
 * @author Fabio Montezuma
 */
public class JComboRenderer extends DefaultListCellRenderer
{
	@Override
	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
	{
		super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

		if (value instanceof Especialidade)
		{
			Especialidade esp = (Especialidade) value;
			setText(esp.getNome());
		}
		
		return this;
	}
}
